home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / GRAPHICS / IMPACT21.ZIP / IMPACT.DOC < prev    next >
Encoding:
Text File  |  1995-01-27  |  10.5 KB  |  185 lines

  1.             Documentation for IMPACT Dynamics Simulator v2.1
  2.  
  3. Copyright (c) 1993,1995 John Henckel
  4. Permission to use, copy, modify, distribute and sell this software
  5. and its documentation for any purpose is hereby granted without fee,
  6. provided that the above copyright notice appear in all copies.
  7. ----------------------------------------------------------------------------
  8. First let me introduce myself.  I'm John Henckel (henckel@vnet.ibm.com).
  9. Currently, I work for IBM in Rochester, Minnesota as a computer programmer.
  10. I like to write fun DOS programs as a hobby, and this is one of them.
  11.  
  12. Impact simulates the collision of 2-dimensional convex polygons with graphical
  13. animation.  The equations for collision of irregularly shaped objects are
  14. taken from "Dynamics" by Pestel and Thomson, 1968.  With the mouse, you can
  15. grab an object and drag it or throw it.  You can stack objects on top of one
  16. another.  You can design experiments interactively, or you can use a text
  17. editor to make scenario files.  As you watch the bodies bouncing off each
  18. other and the the walls, you can get energy reports of the total rotational,
  19. translational, and potential energy.  You can turn on trace and sound to see
  20. the amusing "kinetic artwork".  You can set physical constants restitution
  21. (elasticity), gravity, air friction, and sliding friction.  It works on CGA,
  22. EGA, VGA, or Hercules using Borland BGI. (Help text not readable on Hercules.)
  23. Recommended but not required: mouse and 286 or better.
  24.  
  25. -----------------------------------------------------------------------------
  26. Tutorial
  27.  
  28. Experiment 1:  Kinetic doodling
  29.   Start the program and type "a 2 3 4", this will create two tall tri-
  30.   angles.  Position the mouse in the middle of the screen and
  31.   click button 1.  The nearest triangle will move toward the mouse.
  32.   Now hold down mouse buttons 1 and 2.  All the triangles are drawn
  33.   toward the mouse (but not as quickly).  Press 't', now as the bodies
  34.   move they leave a colorful design behind them.  Press 't' to turn off
  35.   trace, press 'c' to clear the screen.  Press 'd' twice to delete the
  36.   bodies.
  37.  
  38. Experiment 2:  Inclined plane
  39.   Type "a 1 3 10 2" to make a long incline plane.  Type "a 1" to make
  40.   a little box.  Type "g 5" to enable gravity.  Type "r 0.5" to make
  41.   things not so bouncy.  Now using the mouse, pick up the little box
  42.   and set it on the inclined plane.  Then watch it slide down.
  43.  
  44. The Impact program take one command line parameter which is the name
  45. of a scenario file.  See notes below for the file format.  Some
  46. scenario files are included in this package, for example, type
  47.     impact exp1.dat
  48. to load experiment 1 scenario.
  49.  
  50. ------------------------------------------------------------------------
  51.   R E L E A S E    N O T E S
  52. ------------------------------------------------------------------------
  53.  
  54. 1.0 93/11/16 - John Henckel, first release
  55.  
  56. Room for Improvement:
  57. * The program defines impact as whenever the corner of one body enters
  58.   the interior of another body, or enters a wall.  This sounds simple
  59.   but it has many difficulties.  (a) It is possible for two bodies to
  60.   overlap, but neither has a corner inside the other, this is very
  61.   common with triangles because of their sharp corners. (b) It is
  62.   possible for two bodies to each have a corner in the other, in
  63.   this case I pick one arbitrarily. (c) It is possible for a body to
  64.   hit a wall or another body with two of its corners, in this case I
  65.   choose one arbitrarily.   There are certainly better ways to handle
  66.   these cases.
  67. * When gravity is enabled, one would like to stack objects on top of
  68.   one another.  This doesn't work though because the acceleration
  69.   of gravity is constant, but the acceleration of impact becomes zero
  70.   as the bodies slow down.  Thus, they slowly mush into each other.
  71.   To fix this, I added the 'j' parm for center adjustment factor.
  72.   If s=1.0, then after computing the acceleration of impact, the bodies
  73.   are separated from each other so that they no longer overlap.  This
  74.   opens up another question:  what direction should they be separated?
  75.   I use the normal to the impact surface.  This has the nice side-
  76.   effect of simulating sliding.  However, the sliding is only a program
  77.   artifact and not based on physics theory.
  78. * The center adjustment algorithm sometimes fails because of choosing
  79.   the wrong impact surface.  When a body is moving quickly, the impact
  80.   edge can be found by reversing the relative velocity of the corner.
  81.   However, if a body is moving very slowly, instead I choose the
  82.   edge nearest to the corner as the impact surface.  Sometimes this is
  83.   not right.
  84. * "Dynamics" mentions two possible assumptions regarding forces acting
  85.   parallel to the plane of impact.  One is that they cancel relative
  86.   velocities, the other is that the forces are zero.  I have implemented
  87.   the later, i.e. the bodies are perfectly slippery during impact.
  88. * The so-called air friction is not very realistic.  It is a simple
  89.   constant deceleration v' = v * (1-f).  It doesn't take into account
  90.   the shape of the object for aerodynamics.
  91. * Sometimes, if things get moving too quickly, the program will go crazy
  92.   and shapes will fly off the screen into never-land.  When this happens
  93.   a floating-point error usually halts the program in a few seconds.
  94.   Type "mode co80" in DOS to fix the video mode.
  95. * If you try to recompile the source code, you may have some difficulty
  96.   with the registerBGIdriver().  You need to run the BGIOBJ program
  97.   and change the project options.  Or if you prefer, I think you can just
  98.   delete the line with the registerBGIdriver, just make sure EGAVGA.BGI
  99.   is in the current directory at runtime.
  100.  
  101. Acknowledgements:
  102.  This program was developed using Borland Turbo C++ 3.0.  The speed and
  103.  versatility of the graphics of this program is a tribute to the talented
  104.  programmers at Borland.  Also their online help is fabulous.
  105.  The equations for collision of irregularly shaped objects are taken from
  106.  "Dynamics" by Pestel and Thomson, 1968, I haven't found such a detailed
  107.  analysis of this problem in any other book.
  108.  
  109. -------------------------------------------------------------------------
  110.  1.2 93/01/20 - Some improvements:
  111.  
  112. *   The collision algorithm has been substantially improved.  The
  113.   dynamics equations have not been changed, but the method of
  114.   determining which body hit which.  When a body hits a wall, the
  115.   corner deepest in the wall is used for collision.  When two bodies
  116.   collide, all corners on both bodies are searched to find the one
  117.   with the deepest penetration and it is used to compute collision.
  118.   These two changes REALLY helped the stability of stacking objects.
  119. *   I added sliding friction.  When the velocity normal to impact
  120.   between two bodies or a body and a wall is less than some threshold,
  121.   then velocity is changed in each body parallel to the surface inversely
  122.   proportional to mass to decreases the relative motion.  Sliding
  123.   friction is also important for stacking objects.
  124. *   Now you can create scenario description files which can be loaded
  125.   from the command line.  Three scenario files are included in the
  126.   package.  The first line in the file contains 7 physical constants
  127.       friction gravity center-adjust restitution trace-mode
  128.         sliding-threshold sliding-friction
  129.   these are all floats, except trace which is 0 or 1.  The remaining
  130.   lines have the same format as the interactive "a" command.
  131.       count sides aspect-ratio radius color noise mass
  132.         moment pos-x pos-y pos-a vel-x vel-y vel-a
  133.   Trailing data may be omitted.  If you specify 0 for color, mass,
  134.   moment, then the program will generate reasonable values.
  135.   Moment is actually I/m.  Angular data is in radians.  Be careful
  136.   about large numbers, the program does very little checking.
  137.   The virtual screen is 30 by 40, with origin in bottom left.
  138. *   I added a new feature to get an ENERGY REPORT while the program
  139.   is running.  It is fun to watch angular, translational, and
  140.   potential energy change while the total remains about the same.
  141.   The total varies some, I think it is because of the center-adjust
  142.   algorithm.
  143. *   I changed air friction to be v' = v/(1+f*v) which seems more
  144.   realistic.
  145. *   I added some checks to catch things before they crash the
  146.   machine.  You still need to be careful not to set gravity too high.
  147.  
  148. -------------------------------------------------------------------------
  149.  2.1 95/01/26 - Some improvements:
  150.  
  151. *   I added some performance timers and discovered that 60% of the time was
  152.   spent drawing the screen border!  So I fixed that.
  153. *   I tried to add joints but did not succeed.  You can try the joint.dat
  154.   file and see.  The rotational inertia is not conserved as the joint moves
  155.   and the bounce is not correct when the limb hits a wall.  You're welcome
  156.   to try and fix it, I have decided to start over using a new design in c++,
  157.   (someday).  One note:  in the joint file, if you make one part jointed to
  158.   another, then its position and velocity are ignored.  The position and
  159.   velocity of the dependent part is based on the root part.  The "root" and
  160.   the "joint" parent part are not necessarily the same, in case you have
  161.   an arm with several joints.  I haven't tried this, though.  The rest of
  162.   the program works fine, only the joints are buggy.
  163. *   I improved the help text, and other parts of the user interface.
  164. *   Impact does not adjust itself to your CPU speed, it runs as fast as it
  165.   can!  If you have a screaming 90 MHz Pentium then you may need to adjust
  166.   the sample files -- gravity and velocities.  The faster your CPU, the
  167.   smoother and more accurate the simulation.
  168.  
  169. I do not want you to send me any money for this software, but I do like to
  170. get email.  If you make any improvements, please send them to me.  Thanks.
  171.  
  172. Romans 9:19ff
  173. One of you will say to me: "Then why does God still blame us?  For who resists
  174. his will?"  But who are you, O man, to talk back to God?  Shall what is formed
  175. say to him who formed it, "Why did you make me like this?"  Does not the
  176. potter have the right to make out of the same lump of clay some pottery for
  177. noble purposes and some for common use?  What if God, choosing to show his
  178. wrath and make his power known, bore with great patience the objects of his
  179. wrath--prepared for destruction?  What if he did this to make the riches of
  180. his glory known to the objects of his mercy, whom he prepared in advance for
  181. glory--even us, whom he also called, not only from the Jews but also from the
  182. Gentiles?
  183.  
  184. John Henckel      henckel@vnet.ibm.com
  185.